<?php
/**
* author;hc
*/
namespace hc;
class hcstart{
	public static $ctl='';
	public static $method='';
    public static function run(){
		$g=$_REQUEST['g'];
		$c=$_REQUEST['c'];
		$m=$_REQUEST['m'];
		hcrequire(HC_CTL.'/'.$g.'/'.$c.".php");

		$ctl='\\'.$g.'\\'.$c;

		if (!class_exists($ctl, false)) {
			msg_error('类文件'.$c."不存在");
		}
		$app=new $ctl;
		$app->$m();
    	if(HC_TRACE){
			self::web_end();
		}
	}
	//结束程序
	public static function web_end(){
		//小数格式的时间
		$now_time = microtime(true);
		$end_memory=memory_get_usage(); //开始消耗内存
		//网站运行时间
		$run_time = $now_time-$GLOBALS['start_time'];
		echo '<meta charset="utf-8">';
		echo ("<hr />运行情况:");
		echo ("运行时间:".$run_time.'<hr align="left" width="50%" />');
		//网站运行内存
		$run_memory = $end_memory-$GLOBALS['start_memory'];
		echo ("<hr />运行情况:");
		echo ("运行内存:".$run_memory.'<hr align="left" width="50%" />');
		$run_file = $GLOBALS['trice_file'];
		foreach($run_file as $key=>$val){
			echo ($val."<br />");
		}
	}

}
?>
